package ex1;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

/**
 * @author GalK
 */
public class FishFactory implements BeanFactoryAware {

    private BeanFactory bf;

    public Fish getUnuqueFish_1() {
        return (Fish) bf.getBean("aFish");
    }

    public Fish getUnuqueFish() {
        Fish retVal = new Fish();

        StringBuffer sb = new StringBuffer("-").append(1);
        retVal.setName(sb.toString());

        return retVal;
    }

    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.bf = beanFactory;
    }
}
